package com.lmk.qs.jdbc;

import com.lmk.qs.dataSourse.Druid;
import com.lmk.qs.utils.DruidUtil;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * jdbc增删改功能 insert  delete update
 */
public class test02 {
    public static void main(String[] args) throws SQLException {
        Statement st=null;
        Connection connection=null;
        //insert语句需求
        JdbcTemplate jd=new JdbcTemplate( DruidUtil.getDataSource());
            String str="insert into account values(null,'张三',1500)";
            String srt2="update account set name='李四' where id=3";
            String str3="delete from account where id=3";

            int i= 0;
        i = jd.update(str3);

        System.out.println(i);
            if(i>0){
                System.out.println("打印成功");
            }else System.out.println("打印失败");

        }
    }

